/**
 * Ladrillo.
 * @constructor
 * @param {Number} x - pos x.
 * @param {Number} y - pos y.
 * @param {Number} w - anchura (debe corresponder con anchura de sprite).
 * @param {Number} h - altura (debe corresponder con altura de sprite a usar).
 * @param {Number} rx - punto de registro de objeto x.
 * @param {Number} ry - punto de registro de objeto y.
 * @param {Number} scaleX - escala de objeto x (escala de objeto y de sprite a asociar).
 * @param {Number} scaleY - escala de objeto y (escala de objeto y de sprite a asociar).
 * @param {String} imgId - id de imagen de ladrillo a cargar.
 */
function Platform(x, y, sx, sy, w, h, rx, ry, imgId) {
    w = w || 250;
    h = h || 32;
    rx = rx || 125;
    ry = ry || 16;
    sx = sx || 1;
    sy = sy || 1;

    this.animation = null;
    GameObject.call(this, x, y, w, h, rx, ry, sx, sy);
    this.imgId = (imgId) ? imgId : "platform";
};

Platform.DEF_WIDTH = 250;
Platform.DEF_HEIGHT = 32;

Platform.prototype = Object.create(GameObject.prototype);

Platform.prototype.loadAnimations = function() {
    var PlatformImg = GameSys.imgLoader.loadedImages[this.imgId];

        var spriteSheet = new createjs.SpriteSheet({
            images: [PlatformImg],
            frames: {
                width: this.w,
                height: this.h,
                regX: this.rx,
                regY: this.ry
            },
            animations: {
                idle: [0, 0, "idle", 3]
            }
        });

        var bmpAnimation = new createjs.BitmapAnimation(spriteSheet);

        bmpAnimation.regX = bmpAnimation.spriteSheet.frameWidth / 2 | 0;
        bmpAnimation.regY = bmpAnimation.spriteSheet.frameHeight / 2 | 0;

        bmpAnimation.scaleX = this.sx;
        bmpAnimation.scaleY = this.sy;

        bmpAnimation.gotoAndPlay("idle");

        bmpAnimation.shadow = new createjs.Shadow("#454", 0, 5, 4);

        bmpAnimation.currentFrame = 0;

        this.animation = bmpAnimation;


/*    var platform = new createjs.Bitmap(PlatformImg);
    platform.x = this.x;
    platform.y = this.y;
    platform.snapToPixel = true;
    platform.scaleY = this.sy;
    platform.scaleX = this.sx;
    platform.regY = this.ry;
    platform.regX = this.rx;

    this.animation = platform;*/
};
//loadAnimations
